﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;

namespace GT
{
    public static partial class Extensions
    {
        public static string ToQueryString(this NameValueCollection parameters) 
        { 
            List<String> items = new List<String>(); 

            foreach (String name in parameters)
                items.Add(String.Concat(name.UrlEncode(), "=", parameters[name].UrlEncode())); 

            return String.Join("&", items.ToArray()); 
        } 

    }
}
